//
//  AssetImageCell.swift
//  PhotoBrowser
//
//  Created by leotao on 16/5/29.
//  Copyright © 2016年 leotao. All rights reserved.
//

import UIKit
import SnapKit
import AssetsLibrary

class AssetImageCell: UICollectionViewCell {
    var imageView:UIImageView = UIImageView();
    var assets:ALAsset? {
        didSet {
            if assets != nil {
                let image = UIImage(CGImage: assets!.thumbnail().takeUnretainedValue());
                imageView.image = image;
            }
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame);
        
        self.addSubview(imageView);
        imageView.snp_makeConstraints { (make) in
            make.edges.equalTo(self);
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
